package com.yupi.picturebackend.service;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yupi.picturebackend.model.dto.space.SpaceAddRequest;
import com.yupi.picturebackend.model.dto.space.SpaceQueryRequest;
import com.yupi.picturebackend.model.entity.Space;
import com.yupi.picturebackend.model.entity.User;
import com.yupi.picturebackend.model.vo.SpaceVO;

import javax.servlet.http.HttpServletRequest;

/**
* @author 伍立权
* @description 针对表【space(空间)】的数据库操作Service
* @createDate 2025-03-27 21:25:24
*/
public interface SpaceService extends IService<Space> {
    /**
     * 判断空间是否可用
     * @param space
     * @param add
     */
    void validSpace(Space space,boolean add);

    /**
     * 自动填充限额数据
     * @param space
     */
    void fillSpaceBySpaceLevel(Space space);

    /**
     * 新建空间
     * @param spaceAddRequest
     * @param loginUser
     * @return
     */
    long addSpace(SpaceAddRequest spaceAddRequest, User loginUser);

    /**
     * 根据空间对象获取封装对象
     * @param space
     * @param request
     * @return
     */
    SpaceVO getSpaceVo(Space space, HttpServletRequest request);

    /**
     * 构造空间的条件查询器
     * @param spaceQueryRequest
     * @return
     */
    QueryWrapper<Space> getQueryWrapper(SpaceQueryRequest spaceQueryRequest);

    /**
     * 分页获取空间列表
     * @param spacePage
     * @param request
     * @return
     */
    Page<SpaceVO> getSpaceVoPage(Page<Space> spacePage,HttpServletRequest request);

    /**
     * 校验空间权限
     * @param space
     * @param loginUser
     */
    void checkSpaceAuth(Space space, User loginUser);
}
